package com.test.objects;

import java.util.Comparator;

public class MyPageComparator implements Comparator<Comment> {
	public static enum compare_type{
		increase,
		decrease 
	}
	
	public compare_type type;
	
	public MyPageComparator(compare_type _type){
		this.type = _type;
	}
	
	public int compare(Comment c1, Comment c2) {
		if (this.type == compare_type.increase){
			return c1.getDateTime().compareTo(
						c2.getDateTime());
		}else if (this.type == compare_type.decrease){
			return c2.getDateTime().compareTo(
						c1.getDateTime());
		}
		return 0;
	}

}
